
<!DOCTYPE html>
<html>
{[include file="_header.tpl"]}
<body>

<header class="navbar navbar-fixed-top bs-docs-nav">
    {[include file="_nav.tpl"]}
</header>

<main id="main" role="main">

    <div class="container docs-wrapper">
        <div class="row">

            <section id="content" class="col-lg-9 col-md-8 col-sm-8 col-xs-12">
                <h3>更新资料</h3>
                <form method="post" id="form1" name="form1">
				<table class="table table-bordered">
					
					<tr>
						<td class="col-lg-3 col-sm-4 col-xs-5" align="right">帐号：</td>
						<td class="col-lg-9 col-sm-8 col-xs-7"><input type="text" name="username" value="{[$result.username]}" size="16" /></td>
					</tr>
					<tr>
						<td align="right">姓名：</td>
						<td><input type="text" name="name" value="{[$result.name]}" size="16" /></td>
					</tr>
					<tr>
						<td align="right">生日：</td>
						<td><input type="text" name="birthday" id="birthday" value="{[$result.birthday]}" size="16" /></td>
					</tr>
					<tr>
						<td align="right">性别：</td>
						<td><select name='sex' id='sex'>
							{[html_options options=$sex_option selected=$result.sex]}
						</select></td>
					</tr>
					<tr>
						<td align="right">手机：</td>
						<td><input type="text" name="mobile" value="{[$result.mobile]}" size="16" /></td>
					</tr>
					<tr>
						<td align="right">电邮：</td>
						<td><input type="text" name="email" value="{[$result.email]}" size="16" /></td>
					</tr>
					<tr>
						<td align="right">QQ：</td>
						<td><input type="text" name="qq" value="{[$result.qq]}" size="16" /></td>
					</tr>
					<tr>
						<td align="right">地址：</td>
						<td colspan="3"><textarea rows="2" name="address" cols="40">{[$result.address]}</textarea></td>
					</tr>
					<tr>
						<td align="right">备注：</td>
						<td><textarea rows="2" name="content" cols="40">{[$result.content]}</textarea></td>
					</tr>
					<tr>
						<td></td>
						<td><input type="button" value=" 提 交 " name="button_reg" id="button_reg" onclick="edit(this.form);" class="btn-primary">
							<input type="reset" value="复 位" name="B2" class="btn-primary">
						</td>
					</tr>

				</table>
			</form>

            </section>

            <aside id="sidebar" class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
                {[include file="_left.tpl"]}
            </aside>

        </div>
    </div>
</main>

{[include file="_footer.tpl"]}

{[include file="_js.tpl"]}

<script type="text/javascript">

$(function() {

	$("#birthday").datepicker({
		numberOfMonths: 2,
		dateFormat: 'yy-mm-dd',
		showButtonPanel: true,
		// yearRange: '2000:2010',

		beforeShow: function (i, e) {
			var z = jQuery(i).closest(".ui-dialog").css("z-index") + 4;
			e.dpDiv.css('z-index', z);
		}
	});

	$("#birthday").datepicker('option', 'defaultDate', '-30y');
	$("#birthday").datepicker('option', 'changeYear', true);

	// $("input[id^='birthday']:visible").css("width", 100);

});

	function edit(form) {
		// alert("登录成功！");
		var body = $('#form1').formSerialize();

		// var body = form.formSerialize();
		// alert(body);
		$.post('?do=User.editPost', body, function(json) {
			// alert($.toJSON(json));

			// alert("修改成功！");
			if (json.status == 1) {
				alert("资料更新成功！");
				window.open('?do=User.layout', '_self');
			} else if (json.status == 2) {
				alert("密码修改失败！旧密码输入有误！请重新输入！");
			} else if (json.status == 3) {
				alert("密码修改失败！新密码输入有误，请重新输入！");
			}

		}, 'json');
	}

</script>

</body>
</html>
